﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using WX.WMS.DataModel;
using WX.WMS.Common;
using WX.WMS.BLL;

public partial class ClientSearch :PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            init();
        }

    }

    protected void init()
    {
        object action = Request.QueryString["action"];
        if (action == null)
        {
            searchBand();
        }
        else if (action.ToString().Equals("del"))
        {
            string ID = Request.QueryString["ID"].ToString();
            ClientBLL BllClient = new ClientBLL();
            if (BllClient.Delete(ID)< 0)
            {
                searchBand();
                ShowMessage("删除失败");
                
            }
            else {
              
                searchBand();
            }
            

        }

    }
    protected void searchBand()
    {
        SearchResult.DataSource = new ClientBLL().GetClientList();
        SearchResult.DataBind();
    }
    protected void SearchResult_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
       SearchResult.PageIndex= e.NewPageIndex;
       searchBand();
    }
}
